package simulation.bankSim;

import java.util.HashMap;
import java.util.Map;

/*
 * 模拟数据库，存储账户列表
 * 这里我模拟了三个账户
 * 
 * */
public class AccountList {
	private Map<String, Account> accountList = new HashMap<String, Account>();
	
	public AccountList(){
		// 实例化用户。 姓名，卡号，电话
		Customer customer1 = new Customer("唐僧","201430810302","123456");
		Customer customer2 = new Customer("八戒","201430810325","222333");
		Customer customer3 = new Customer("悟空","201430810333","333333");
		// 实例化账户。 卡号，余额，用户，密码
		Account account1 = new Account("201430810302",2000,customer1,"1234");
		Account account2 = new Account("201430810325",5000,customer2,"8888");
		Account account3 = new Account("201430810333",4500,customer3,"7777");
		// 将账户存储进accountList里
		accountList.put("201430810302", account1);
		accountList.put("201430810325", account2);
		accountList.put("201430810333", account3);
	}
	
	// 根据卡号查找一个账户
	public Account getAccountByCardNo(String cardNo){
		return accountList.get(cardNo);
	}
}
